import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class VerifyService extends BaseService<any> {
  private readonly logger = new Logger(VerifyService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getPage
   * 对应 PHP: VerifyService_admin::getPage()
   * 逻辑类型: undefined - undefined
   */
  async getPage(where: any[]) {
    // 基于PHP真实逻辑: getPage
    // PHP原文: $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['code', 'type', 'create_time', 'verifier_member_id', 'relate_tag'...
const search_model = this.model.where([['site_id', '=', this.site_id))).withSearch(['code', 'type', 'create_time', 'verifier_member_id', 'relate_tag', 'keyword', 'order_id'), where)
            .with([member: function (query) {
                query.field('member_id, nickname, mobile, headimg');
  }

  /**
   * getList
   * 对应 PHP: VerifyService_admin::getList()
   * 逻辑类型: undefined - undefined
   */
  async getList(where: any[]) {
    // 基于PHP真实逻辑: getList
    // PHP原文: $list = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['code', 'type', 'create_time', 'verifier_member_id', 'relate_tag', 'keywo...
const list = this.model.where([['site_id', '=', this.site_id))).withSearch(['code', 'type', 'create_time', 'verifier_member_id', 'relate_tag', 'keyword', 'order_id'), where)
            .with([member: function (query) {
                query.field('member_id, nickname, mobile, headimg');
  }

  /**
   * getDetail
   * 对应 PHP: VerifyService_admin::getDetail()
   * 逻辑类型: undefined - undefined
   */
  async getDetail(verify_code: string) {
    // 基于PHP真实逻辑: getDetail
    // PHP原文: $info = $this->model->where([             ['site_id', '=', $this->site_id],             ['code', '=', $verify_code]         ])->field('*')            ...
const info = this.model.where([
            ['site_id', '=', this.site_id],
            ['code', '=', verify_code)
        )).field('*')
            .with([member: function (query) {
                query.field('member_id, nickname, mobile, headimg');
  }

  /**
   * verify
   * 对应 PHP: VerifyService_admin::verify()
   * 逻辑类型: undefined - undefined
   */
  async verify(verify_code: string, num: string) {
    // 基于PHP真实逻辑: verify
    // PHP原文: return (new CoreVerifyService())->adminVerify($this->site_id, $verify_code);     }      /**      * 框架后台核销      * @param string $verify_code      * @pa...
return this.coreVerifyService.adminVerify(this.site_id, verify_code);
    }

    /**
     * 框架后台核销
     * @param string verify_code
     * @param num
     * @return true
     */
    async getInfoByCode(string verify_code)
    {

        return this.coreVerifyService.adminGetInfoByCode(this.site_id, verify_code);

    }

}
  }

  /**
   * getInfoByCode
   * 对应 PHP: VerifyService_admin::getInfoByCode()
   * 逻辑类型: undefined - undefined
   */
  async getInfoByCode(verify_code: string) {
    // 基于PHP真实逻辑: getInfoByCode
    // PHP原文: return (new CoreVerifyService())->adminGetInfoByCode($this->site_id, $verify_code);      }  }...
return this.coreVerifyService.adminGetInfoByCode(this.site_id, verify_code);

    }

}
  }
}
